#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n63_lwl_test)
    .set noreorder
    addiu s0, s0, 1
    li  s2, 0x0
###test inst
    TEST_LWL(0xf507f480, 0x79e8d3ee, 0x800d0000, 0x00002a22, 0x00002a20, 0xe8d3ee80 )
    TEST_LWL(0x72a144f8, 0x2b9cb084, 0x800d0000, 0x0000e5ce, 0x0000e5cc, 0x9cb084f8 )
    TEST_LWL(0x73669280, 0x6565a854, 0x800d0000, 0x000018c6, 0x000018c4, 0x65a85480 )
    TEST_LWL(0xe9c2d280, 0x173bcf08, 0x800d0000, 0x0000d06f, 0x0000d06c, 0x173bcf08 )
    TEST_LWL(0x1e4fa23a, 0x8742cbba, 0x800d0000, 0x00006422, 0x00006420, 0x42cbba3a )
    TEST_LWL(0x426ca5b6, 0x857afc00, 0x800d0000, 0x0000cd83, 0x0000cd80, 0x857afc00 )
    TEST_LWL(0xbd1ece34, 0xd8b8a164, 0x800d0000, 0x00005b89, 0x00005b88, 0xa164ce34 )
    TEST_LWL(0x3f4484d0, 0x490c599d, 0x800d0000, 0x00007fe9, 0x00007fe8, 0x599d84d0 )
    TEST_LWL(0xc27479f4, 0xb54aa7a0, 0x800d0000, 0x0000cc6d, 0x0000cc6c, 0xa7a079f4 )
    TEST_LWL(0xc851d2d8, 0xd04609e0, 0x800d0000, 0x00009ddf, 0x00009ddc, 0xd04609e0 )
    TEST_LWL(0x86c9bad0, 0x49eb9cd2, 0x800d0000, 0x00007320, 0x00007320, 0xd2c9bad0 )
    TEST_LWL(0x638ca038, 0x91c230c0, 0x800d0000, 0x00000ceb, 0x00000ce8, 0x91c230c0 )
    TEST_LWL(0x9b3910fc, 0x88f9eac8, 0x800d0000, 0x00001e10, 0x00001e10, 0xc83910fc )
    TEST_LWL(0x4cdb9fc0, 0x3d2e606d, 0x800d0000, 0x000068a4, 0x000068a4, 0x6ddb9fc0 )
    TEST_LWL(0x3d874000, 0x4051304f, 0x800d0000, 0x0000cb20, 0x0000cb20, 0x4f874000 )
    TEST_LWL(0xb28853e8, 0x53d2adb0, 0x800d0000, 0x00003080, 0x00003080, 0xb08853e8 )
    TEST_LWL(0x60f9ef98, 0x1cbda588, 0x800d0000, 0x0000e2f8, 0x0000e2f8, 0x88f9ef98 )
    TEST_LWL(0x4bbbb640, 0x89a664e9, 0x800d0000, 0x0000d9cb, 0x0000d9c8, 0x89a664e9 )
    TEST_LWL(0xd723f348, 0x7e06b85c, 0x800d0000, 0x0000d080, 0x0000d080, 0x5c23f348 )
    TEST_LWL(0x85760d94, 0xb209a600, 0x800d0000, 0x0000d9e2, 0x0000d9e0, 0x09a60094 )
    TEST_LWL(0xfc1306ac, 0x9d57db6e, 0x800d0000, 0x00007193, 0x00007190, 0x9d57db6e )
    TEST_LWL(0xd301ac00, 0xb59367ec, 0x800d0000, 0x0000b7e2, 0x0000b7e0, 0x9367ec00 )
    TEST_LWL(0xd828c70a, 0xb1e84a28, 0x800d0000, 0x00000bf9, 0x00000bf8, 0x4a28c70a )
    TEST_LWL(0xf71cc240, 0xcaee8900, 0x800d0000, 0x000052b4, 0x000052b4, 0x001cc240 )
    TEST_LWL(0x408be1d8, 0x7ef19e82, 0x800d0000, 0x00005cd9, 0x00005cd8, 0x9e82e1d8 )
    TEST_LWL(0x6b14a542, 0x2536e1a2, 0x800d0000, 0x00004006, 0x00004004, 0x36e1a242 )
    TEST_LWL(0x7ba4d948, 0x8477d348, 0x800d0000, 0x00005330, 0x00005330, 0x48a4d948 )
    TEST_LWL(0x84690526, 0x412355c8, 0x800d0000, 0x00001e67, 0x00001e64, 0x412355c8 )
    TEST_LWL(0x631ee490, 0x37ea65b9, 0x800d0000, 0x00000b40, 0x00000b40, 0xb91ee490 )
    TEST_LWL(0x65686ab0, 0xc2247808, 0x800d0000, 0x000059be, 0x000059bc, 0x247808b0 )
    TEST_LWL(0x728c4522, 0x9e689a80, 0x800d0000, 0x000046e0, 0x000046e0, 0x808c4522 )
    TEST_LWL(0xd62c931b, 0x80bc0130, 0x800d0000, 0x0000b2f4, 0x0000b2f4, 0x302c931b )
    TEST_LWL(0x28359298, 0xb37458fc, 0x800d0000, 0x0000d274, 0x0000d274, 0xfc359298 )
    TEST_LWL(0xab7ab6a0, 0x39ef09d0, 0x800d0000, 0x0000e343, 0x0000e340, 0x39ef09d0 )
    TEST_LWL(0x3f11d950, 0xdd81b4c0, 0x800d0000, 0x0000cfea, 0x0000cfe8, 0x81b4c050 )
    TEST_LWL(0xe5de44e0, 0xceec14d4, 0x800d0000, 0x000086da, 0x000086d8, 0xec14d4e0 )
    TEST_LWL(0x0b0194c0, 0xbcf83a04, 0x800d0000, 0x00002f26, 0x00002f24, 0xf83a04c0 )
    TEST_LWL(0xd46a7728, 0x45cb3da8, 0x800d0000, 0x00008700, 0x00008700, 0xa86a7728 )
    TEST_LWL(0x4980ca18, 0x61afc528, 0x800d0000, 0x00000331, 0x00000330, 0xc528ca18 )
    TEST_LWL(0x1dbc4288, 0x078c4734, 0x800d0000, 0x0000641b, 0x00006418, 0x078c4734 )
    TEST_LWL(0x3e494520, 0xc0bb4870, 0x800d0000, 0x0000cc84, 0x0000cc84, 0x70494520 )
    TEST_LWL(0x944e1180, 0x2c731001, 0x800d0000, 0x0000d54f, 0x0000d54c, 0x2c731001 )
    TEST_LWL(0x40284e74, 0x1bf11590, 0x800d0000, 0x00005e70, 0x00005e70, 0x90284e74 )
    TEST_LWL(0x58190616, 0x3d4e0906, 0x800d0000, 0x0000dbd8, 0x0000dbd8, 0x06190616 )
    TEST_LWL(0x28f41bd6, 0xaf0f1820, 0x800d0000, 0x00001c4f, 0x00001c4c, 0xaf0f1820 )
    TEST_LWL(0x6b24f520, 0x86a0295a, 0x800d0000, 0x0000279e, 0x0000279c, 0xa0295a20 )
    TEST_LWL(0xefc80100, 0x53ae51c0, 0x800d0000, 0x0000724a, 0x00007248, 0xae51c000 )
    TEST_LWL(0x10569ba5, 0x820ee0e0, 0x800d0000, 0x0000b7f0, 0x0000b7f0, 0xe0569ba5 )
    TEST_LWL(0x1a1629c0, 0x3b64bb70, 0x800d0000, 0x00006c96, 0x00006c94, 0x64bb70c0 )
    TEST_LWL(0x0b1c70a0, 0xbbb05b64, 0x800d0000, 0x00005c58, 0x00005c58, 0x641c70a0 )

###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n63_lwl_test)
